package com.jic.product.mapper;

import com.jic.product.entity.Category;
import com.jic.product.entity.ProductBrand;
import com.jic.product.entity.vo.request.CategoryPage;
import com.jic.product.manage.request.CategoryRequest;
import com.jic.product.manage.response.CategoryResponse;
import com.jic.product.manage.response.CategorySecondRest;
import com.jic.product.manage.response.CategorySecondSonRest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 类目节点
 * @author :
 * @email :
 * @since : 2020-01-10 07:03:01
 * @version : v1.0.0
 */
@Mapper
public interface  CategoryMapper {
    List<CategoryResponse> selectCategory (Category category);

    List<CategoryResponse> selectPageCategory (CategoryPage category);

    long insert(Category category);

    long delete(Long id);

    long update(Category category);
    long updateIncrement(List<Category> category);

    Category queryByPrimaryKey(Long id);

    List<CategoryResponse> queryBehindCategory(CategoryRequest categoryRequest);//查询后台类目

    List<CategoryResponse> queryBeforeCategory(CategoryRequest categoryRequest);//查询前台类目

    List<CategorySecondRest> queryBeforeSecondCategory(CategoryRequest categoryRequest);//查询当前生效的所有二级类目

    List<CategorySecondSonRest> queryBeforeSecondSonCategory(CategoryRequest categoryRequest);//查询当前二级类目的子类目

    List<Category> queryPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("category") Category category);

    long queryPageCount(Category category);

    List<Category> query(Category category);//条件查询

    /**
     * 查询过滤本身数据
     * @param category
     * @return
     */
    List<Category> queryNotItself(Category category);

    /**
     * 查询过滤指定数据
     * @param category
     * @return
     */
    List<Category> queryOrCategory(Category category);

    List<Category> queryRestCategory();//条件查询


    List<CategoryResponse> queryAfterSecondSonCategory(CategoryRequest categoryRequest);//查询当前二级类目的子类目

    /**
     * description: 根据父类Id查找其子类
     * @author: jackHe
     * @time: 2020/4/28 14:15
     */
    List<Category> queryById(Long id);


    List<CategoryResponse> queryRestCategoryForIndex();//查询首页类目

    List<CategorySecondSonRest> queryBeforeSecondSonCategoryForPc(CategoryRequest categoryRequest);//查询当前二级类目的子类目 PC

    /**
     * description: 根据父类Id查找其子类
     * @author: jackHe
     * @time: 2020/4/28 14:15
     */
    List<Category> queryByIds(@Param("ids") List<String> ids);


    List<Category> listRestPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("category") Category category);

    long listRestPageCount(Category category);

}
